from sqlalchemy.ext.asyncio import AsyncSession

from tinkoff_bot.infrastructure.database import repositories as repo
from tinkoff_bot.infrastructure.database.uow.base import SQLAlchemyBaseUoW


class SQLAlchemyUoW(SQLAlchemyBaseUoW):
    def __init__(
        self,
        *,
        session: AsyncSession,
        user_repo: repo.UserRepoImpl,
        user_reader: repo.UserReaderImpl,
    ) -> None:
        self.user_reader = user_reader
        self.user_repo = user_repo

        super().__init__(session=session)


def build_uow(session: AsyncSession):
    return SQLAlchemyUoW(
        session=session,
        user_reader=repo.UserReaderImpl(session),
        user_repo=repo.UserRepoImpl(session),
    )
